#region Using directives
using System;
using System.Collections.Generic;
#endregion

namespace SharpWind.Helpers
{
	internal class GarbageManager
	{
		#region Fields

		private List<IDisposable> garbage = null;

		#endregion

		#region Constructors

		internal GarbageManager()
		{
			this.garbage = new List<IDisposable>();
		}

		#endregion

		#region Methods

		public void Add( IDisposable disposable )
		{
			this.garbage.Add( disposable );
		}

		public void Dispose()
		{
			foreach( IDisposable disposable in this.garbage )
			{
				disposable.Dispose();
			}

			GC.Collect();
		}

		#endregion
	}
}
